home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / Utilities / Installer v3.4.3 / Examples - Installer 3.4 / Action Atom Samples / InstallFileOnBootVolAA / InstallFileOnBootVol.r < prev    next >
Encoding:
Text File  |  1993-06-15  |  7.2 KB  |  194 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.4 sample: Action Atom sample to install a file in the
  6.  *                            System Folder of the boot volume.
  7.  *
  8.  *    File:        InstallFileOnBootVol.r -    Rez Source
  9.  *
  10.  *  Modifications:
  11.  *        5/19/93: RRK Changed Target file spec typeCrMustMatch flag setting to
  12.  *                        typeCrNeedNotMatch and included comment that this will
  13.  *                        allow the replacement of the target file if for some reason
  14.  *                        the file or creator are different.
  15.  *                     Used InstallerCommon.r defines.
  16.  *
  17.  *    by:            Rich Kubota
  18.  *
  19.  *    Copyright © 1991 Apple Computer, Inc.
  20.  *    All rights reserved.
  21.  *
  22.  *------------------------------------------------------------------------------
  23.  *
  24.  * Install application "TheProgram" into the Start-up folder in the boot system
  25.  * folder regardless of the volume selected by the user.  There are a number of 
  26.  * caveats associated with using this sample action atom.  See the code resource
  27.  * for the specific caveats.
  28.  *----------------------------------------------------------------------------*/
  29.  
  30. #include "Types.r"
  31. #include "InstallerTypes.r"
  32. #include "InstallerCommon.r"        /* list of macros to simplify list */
  33.  
  34. /* 'inaa' code resource definition */
  35. #define        aaCodeID                128
  36.  
  37. /* You can build and complete the script with the following lines:
  38. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  39. # or set up folders with the same names and contents as the floppies
  40. # put these folders in the same folder as the script or at the root directory of same disk
  41.  
  42.     rez -o "InstallFileOnBootVol" -t 'bbkr' -c 'bbkr' "InstallFileOnBootVol.r"
  43.     setfile -a i "InstallFileOnBootVol"        #mark Inited
  44.     scriptcheck -p "InstallFileOnBootVol"
  45. */
  46.  
  47. #define kMinMemMB                01    /* memory needed to install (UPDATE Error Message if changed!)*/
  48.  
  49. /* Definitions for the rules */
  50. #define rlCheckMemSize            1000
  51. #define rlOutputMemSizeError    1001
  52.  
  53. /* Defines for the file spec atoms (specifications for source and destination files) */
  54. #define fsSourceProgram            2000
  55. #define fsTargetProgram            2001
  56.  
  57. /* This is the name of the source disk */
  58. #define ProgramDisk "Program Disk:"
  59.  
  60. /* where we want to install our file on the boot volume - use folder mgr designation. */
  61. #define TargetPath    "Special-strt:"
  62.  
  63. /* Definition for the package. */
  64. #define pkTheProgram            3000
  65.  
  66. /* Definition for the file atom */
  67. #define faProgram                4000
  68.  
  69. /* Definition for the package comment resource */
  70. #define cmtTheProgram            5000
  71.  
  72. /* Definitions for the action atom resources */
  73. #define aaInstallFile            6000
  74.  
  75. /* May 19, 1993 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  76. /* this value to a LongInt seconds value needed by the Installer. */
  77. #define currentReleaseDate        5191993    
  78. #define currentVersion            102     /* Version 1.0.2 goes in the 'icmt' rsrc */
  79.  
  80. #define iconTheProgram            5100
  81.  
  82. /************************** Easy Install Rule resources **********************************/
  83. resource 'infr' (1) {
  84.     format0  {{
  85.         pickFirst,    {rlCheckMemSize, rlOutputMemSizeError},     /* Select only one of these rules */
  86.     }};
  87. };
  88.  
  89. resource 'inrl' (rlCheckMemSize) {
  90.     format0 {{
  91.         /* If the system has at least kMinMemMB megs of memory, then add the package */
  92.         checkMinMemory {kMinMemMB},
  93.         addUserDescription {"The Program\n"},    /* message to appear in Easy Install screen */
  94.         addPackages {{pkTheProgram}}            /* we're installing the program */
  95.     }};
  96. };
  97.  
  98. resource 'inrl' (rlOutputMemSizeError) {
  99.     format0 {{
  100.         /* This error message will be displayed on the Easy Install screen if this rule */
  101.         /* fires.  It fires if the first rule in this pickFirst group does not fire */
  102.         
  103.         reportSysError {"To do installation you need:\n\n"},
  104.         reportSysError {"• At least 1 megabyte of memory\n"}    /*if kMinMemMB changes FIX HERE! */
  105.     }};
  106. };
  107.  
  108. /***************************** Package Resources ************************************************/
  109. resource 'inpk' (pkTheProgram) {
  110.     format0 {
  111.         showsOnCustom,                 /* Package appears in the Custom Install display */
  112.         notRemovable,                /* Package can be removed */
  113.         dontForceRestart,            /* no need to reboot after live install */
  114.         cmtTheProgram,                 /* package's 'icmt' resource id */
  115.         0,                            /* Package size (filled in by ScriptCheck) */
  116.         "Teach Text in Boot System Folder", {                
  117.                                     /* package name for package that shows on custom */
  118.             'inaa', aaInstallFile;
  119.         }
  120.     }
  121. };
  122.  
  123. /***************************** Comments ************************************************/
  124. resource 'icmt' (cmtTheProgram) {
  125.     currentReleaseDate,
  126.     currentVersion,
  127.     iconTheProgram,
  128.     "This package installs TeachText into the startup folder in the boot system folder. "
  129. };
  130.  
  131. resource 'ICON' (iconTheProgram) {
  132.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  133.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  134.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  135.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  136.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  137.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  138.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  139.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  140. };
  141.  
  142.  
  143. /********************************************* File Specs ******************************************/
  144. /* Source File Specs */
  145. resource 'infs' (fsSourceProgram) {
  146.     'APPL',                                /* File Type */
  147.     'ttxt',                                /* Creator */
  148.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  149.     noSearchForFile,                    /* Do not search the source disk for the file */
  150.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  151.     ProgramDisk"TeachText"                /* Path to the file */
  152. };
  153.  
  154. /* Target File Specs */
  155. resource 'infs' (fsTargetProgram) {
  156.     'APPL',                                /* File Type */
  157.     'ttxt',                                /* Creator */
  158.     kNoDateStampCheck,                    /* creation date must be zero for target file spec */
  159.     noSearchForFile,                    /* Do not search the target disk for the file */
  160.     typeCrNeedNotMatch,                    /* file to be replaced even if F&C don't match  */
  161.     TargetPath"TeachText"                /* destination Path */
  162. };
  163.  
  164. /******************************************** File Atoms ************************************************/
  165. resource 'infa' (faProgram) {
  166.     format0 {
  167.         StdRemLeaveNewerCopy,            /* see InstallerCommon.r */
  168.         fsTargetProgram,                /* TARGET file spec */
  169.         fsSourceProgram,                 /* SOURCE file spec */
  170.         0,                                /* atom size (filled in by ScriptCheck) */
  171.         ""                                /* Atom Description (for a file Installer will use file name) */
  172.     };
  173. };
  174.  
  175. /******************************************** Action Atoms ************************************************/
  176. resource 'inaa'    (aaInstallFile) {
  177.     format1 {
  178.         continueBusyCursors,            /* have the busy cursor continue to display while file being installed */
  179.         actAfter,                        /* act after the rest of the installation has run */
  180.         dontActOnRemove,                /* the atom does not recognise the option to remove the file */
  181.         actOnInstall,                    /* act when the user clicks the Install button */
  182.         'infn',                            /* resource type of code resource */
  183.         aaCodeID,                        /* code resource ID to execute */
  184.         faProgram,                        /* for this example, pass the 'infa' resource ID of the file to
  185.                                          * copy to the System Folder of the boot disk.
  186.                                          */
  187.         "Installing TeachText in the startup folder on the boot drive."
  188.     }
  189. };
  190.  
  191.  
  192. INCLUDE    "InstallFileOnBootVol.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  193.  
  194.